package de.baumann.browser.views.dialog

import android.content.Context
import android.widget.Toast
import de.baumann.browser.R
import de.baumann.browser.activitys.oc.OcCreateWalletActivity
import de.baumann.browser.utils.ViewUtil
import kotlinx.android.synthetic.main.dialog_walletagreement.*

class OcWalletAgreementDialog(context: Context) : BaseDialog(context) {
    override fun laoutId(): Int {
        return R.layout.dialog_walletagreement
    }

    override fun initView() {
        setCanceledOnTouchOutside(false)
        setCancelable(false)
        webViewAgreement.loadUrl("file:///android_asset/wallet_protocol.html")
        ViewUtil.configWebView(webViewAgreement)
        btnAgree.setOnClickListener {
            if (!cbAgree.isChecked) {
                Toast.makeText(mContext, "请阅读并同意服务条款", Toast.LENGTH_SHORT).show()
                return@setOnClickListener
            }
            dismiss()
            OcCreateWalletActivity.startOcCreateWalletActivity(mContext)
        }
    }
}